# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
File    : run.py
Time    : 2024/2/20 15:46
author  : mojin
Email   : 397135766@qq.com
-------------------------------------------------------------------------------
"""
import pytest,subprocess,shutil

def main():

    try:
        shutil.rmtree("./target")  # 删除报告目录，删除后只能看到当前执行后的报告结果，不删除能看到执行的历史执行结果
    except:
        pass


    pytest.main([ '-vs',"--alluredir","target/allure-results"])#'-k test_0003',#'./test_case',



    allure_html = 'allure generate ./target/allure-results -o ./target/allure-report --clean'  # 生成allure的html报告
    subprocess.call(allure_html, shell=True)  # 生成allure的html报告

if __name__ == '__main__':

    main()


